<template>
    <n-result status="500" title="500 服务器错误" description="服务器出错可能说明该雇更多程序员了">
        <template #footer>
            <n-button @click="checkNetwork">检查网络</n-button>
        </template>
    </n-result>
</template>

<script setup>
import { NResult, NButton } from 'naive-ui'
import { onMounted } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
//判断是否有网络
const hasNetwork = navigator.onLine;
const checkNetwork = () => {
    if (hasNetwork) {
        router.push('/');
    } else {
        // 尝试打开Windows网络设置，适用于一些浏览器
        window.open('ms-settings:network', '_blank');
    }
}
onMounted(() => {
    checkNetwork();
})
</script>

<style scoped lang="scss">
.n-result {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
</style>
